<template>
  <div class="common-container" v-if="data">
    <CommonNav :data="data"/>
    <ul class="t-body" v-if="data.id == 'm-like'">
      <router-link
        to="/"
        v-for="(item, i) in data.tbody"
        :key="i"
        :style="{ width: size + '%' }"
      >
        <li>
          <div class="card">
            <img :src="item.img" class="image" />

            <div class="info-box">
              <div class="title" :title="item.title">
                {{ item.title }}
              </div>
              <div class="adress">{{ item.adress }}</div>
              <div class="price-box">
                <span>
                  <span class="yuan">￥</span>
                  <span class="price-number numfont">{{ item.price }}</span>
                  <span class="price-desc">起</span></span
                >
              </div>
            </div>
          </div>
        </li>
      </router-link>
    </ul>
    <ul class="t-body" v-if="data.id == 'hotel'">
      <router-link
        to="/"
        v-for="(item, i) in data.tbody"
        :key="i"
        :style="{ width: 33.3 + '%' }"
      >
        <li>
          <div class="card">
            <div class="img">
              <img :src="item.img" class="image" />
              <el-avatar
                :src="item.avatar"
                class="avatar"
                :size="48"
              ></el-avatar>
            </div>

            <div class="info-box">
              <div class="title" :title="item.title">
                {{ item.title }}
              </div>
              <div class="adress">
                <span>{{ `整套${item.number}居士-` }}</span>
                <span>{{ `可住${item.capacity}人 | ` }}</span>
                <span>{{ item.adress }}</span>
              </div>
              <div class="price-box">
                <span>
                  <span class="yuan">￥</span>
                  <span class="price-number numfont">{{ item.price }}</span>
                </span>
              </div>
            </div>
          </div>
        </li>
      </router-link>
    </ul>
  </div>
</template>

<script>
import CommonNav from '../components/commonNav.vue'
export default {
  components:{
    CommonNav,

  },
  props: {
    data: {
      type: Object,
    },
    size: {
      type: Number,
      default: 20,
    },
  },
};
</script> 

<style lang="less" scoped>
.common-container {
  margin-top: 40px;
  background-color: #fff;
  .t-body {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #e5e5e5;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 645px;
    overflow: hidden;
    display: flex;
    flex-wrap: wrap;
    padding: 10px 10px 20px;
    background-color: #fff;
    a {
      display: inline-block;
      // width: 20%;
      border: 1px solid transparent;
      border-radius: 5px;
      overflow: hidden;
      box-sizing: border-box;
      padding: 10px;
      vertical-align: middle;
      position: relative;
      li {
        .img {
          position: relative;
          // width: inherit;
          .image {
            width: 100%;
            border-radius: 5px;
            object-fit: cover;
          }
          .avatar {
            position: absolute;
            bottom: -19px;
            z-index: 999;
            right: 15px;
            border: 2px solid #fff;
          }
        }
        .avatar {
          position: absolute;
          bottom: 0px;
          z-index: 999;
        }
        .info-box {
          padding: 8px 5px 0px;
          .title {
            width: 100%;
            height: 22px;
            line-height: 22px;
            font-size: 16px;
            text-overflow: ellipsis;
            overflow: hidden;
            white-space: nowrap;
          }
          .adress {
            margin-top: 4px;
            width: 100%;
            height: 18px;
            line-height: 18px;
            font-size: 12px;
            color: #999;
            text-overflow: ellipsis;
            overflow: hidden;
            white-space: nowrap;
          }
          .price-box {
            color: #ff6600;
            font-size: 22px;
            .yuan {
              font-size: 14px;
              font-weight: 700;
            }
            .price-desc {
              font-size: 12px;
              font-weight: 700;
              margin-left: 1px;
            }
          }
        }
      }
    }
  }
 
}
</style>